FROM jenkins/jenkins:lts-centos

#这里有风险
USER root

ENV TZ=Asia/Shanghai

#按照需求-v替换.m2的settings.xml就好了
RUN  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak && curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo && yum update -y && yum install -y lrzsz && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 安装 docker-compose  --- 挂载宿主机上的就可以了
# RUN curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
# RUN chmod +x /usr/local/bin/docker-compose
# https://www.cnblogs.com/jay763190097/p/8305911.html
# docker run --name jenkins \
# -p 8008:8080 \
# -p 50000:50000 \
# --add-host='centos6.5:192.168.0.8' \   # 增加额外host，这个是gitlab的ip
# -v /opt/maven3.5.2:/var/maven3.5.2 \
# -v /opt/maven_jar:/var/maven_jar \
# -v /home/jenkins/settings.xml:/var/jenkins_home/.m2/settings.xml \
# -v /etc/localtime:/etc/localtime:ro \
# -v /home/jenkins/data:/var/jenkins_home \
# -v /var/run/docker.sock:/var/run/docker.sock \
# -v $(which docker):/usr/bin/docker \
# -v $(which docker-compose):/usr/local/bin/docker-compose \
# -d com.jay.myjenkins:latest
